package uk.co.davedexter.FlickrManager;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * A class representing the information for images uploaded to flickr
 * 
 * @author ddexter
 * 
 */

public class FlickrImage {
	private long id;
	private String title;
	private String image_name;
	private Timestamp upload_date;
	private Timestamp taken_date;
	private ArrayList<String> tags;
	private String original_url;
	private String small_url;
	private String description;

	FlickrImage(long id, String title, String image_name, Timestamp upload_date, Timestamp taken_date,
			String tagString, String original_url, String small_url, String description) {
		this.id = id;
		this.title = title;
		this.image_name = image_name;
		this.upload_date = upload_date;
		this.taken_date = taken_date;
		this.original_url = original_url;
		this.small_url = small_url;
		this.description = description;
		String[] tagsArray = tagString.split(" ");
		tags = new ArrayList<String>();
		for (String tag : tagsArray) {
			tags.add(tag);
		}
		Collections.sort(tags);
	}
	
	public long getId() { return id; }
	public String getTitle() { return title; }
	public String getImageName() { return image_name; }
	public String getDescription() { return description; }
	public Timestamp getTakenDate() { return taken_date; }
	public Timestamp getPostedDate() { return upload_date; }
	public String getTags() {
		String tagString = "";
		for (String tag : tags) { tagString += tag + " "; }
		return tagString.trim();
	}
	public void setTitle(String newTitle) { title = newTitle; }
	public void setImageName(String newImageName) { image_name = newImageName; }
	public void setUploadDate(Timestamp newUploadDate) { upload_date = newUploadDate; }
	
}
